<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>押金记录管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {

	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/jiujiudevice/jiuCashRecord/">押金记录列表</a></li>
		<%-- 		<shiro:hasPermission name="jiujiudevice:jiuCashRecord:edit"><li><a href="${ctx}/jiujiudevice/jiuCashRecord/form">押金记录添加</a></li></shiro:hasPermission>
 --%>
	</ul>
	<form:form id="searchForm" modelAttribute="jiuCashRecord"
		action="${ctx}/jiujiudevice/jiuCashRecord/" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden"
			value="${page.pageSize}" />
		<label>订单号：</label>
		<form:input path="orderNo" htmlEscape="false" maxlength="50"
			class="input-medium" />
		&nbsp;
		<label>会员名字：</label>
		<form:input path="memberNickname" htmlEscape="false" maxlength="50"
			class="input-medium" />
		&nbsp; 
		<label>押金状态： </label>
		<select name="status" style="width: 100px;">
			<option value="" selected="selected">--- 状态 ---</option>
			<option value="1">已支付</option>
			<option value="2">已退款</option>
		</select>
		&nbsp;
		<label>支付状态： </label>
		<select name="payStatus" style="width: 100px;">
			<option value="" selected="selected">--- 状态 ---</option>
			<option value="0">失败</option>
			<option value="1">成功</option>
		</select>
		&nbsp;
		<label>退款状态： </label>
		<select name="refundStatus" style="width: 100px;">
			<option value="" selected="selected">--- 状态 ---</option>
			<option value="0">失败</option>
			<option value="1">成功</option>
		</select>
		&nbsp; 
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" />
	</form:form>
	<tags:message content="${message}" />
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead>
			<tr>
				<th>订单号</th>
				<th>会员名</th>
				<th>订单金额</th>
				<th>交易号</th>
				<th>订单状态</th>
				<th>创建时间</th>
				<shiro:hasPermission name="jiujiudevice:jiuSn:edit"><th>操作</th></shiro:hasPermission></tr></thead>
				
		<tbody>
			<c:forEach items="${page.list}" var="jiuCashRecord">
				<tr>
					<td>${jiuCashRecord.orderNo }</td>
					<td><a
						href="${ctx}/wechat/jiuWechatMember/form?id=${jiuCashRecord.memberId}">${jiuCashRecord.memberNickname}</a></td>
					<td>${jiuCashRecord.money }</td>
					<td>${jiuCashRecord.transactionId }</td>
					<td>${jiuCashRecord.status == 0 ? "未支付" : jiuCashRecord.status == 1 ? "已支付" : "已退款"}</td>
					<td><fmt:formatDate value="${jiuCashRecord.createTime }"
							type="both" /></td>
					<%-- <td>${jiuCashRecord.payStatus == null  ?  " --- "  : jiuCashRecord.payStatus == 0 ? "支付失败" : "支付成功" }</td>
					<td><fmt:formatDate value="${jiuCashRecord.payTime }"
							type="both" /></td>
					<td>${jiuCashRecord.refundStatus == null  ? " --- " : jiuCashRecord.refundStatus == 0 ? "退款失败" : "退款成功" }</td>
					<td><fmt:formatDate value="${jiuCashRecord.refundTime }"
							type="both" /></td> --%>
					<shiro:hasPermission name="jiujiudevice:jiuSn:edit"><td>
					<c:choose>
						<c:when test="${jiuCashRecord.refundStatus == 0 }">
		    				<a class="btn btn-danger"  href="#" data-toggle="modal" data-target="#myOrder_${jiuCashRecord.id}">查看明细</a>
						</c:when>
						<c:otherwise>
	    					<a class="btn btn-success"  href="#" data-toggle="modal" data-target="#myOrder_${jiuCashRecord.id}">查看明细</a>
						</c:otherwise>
					</c:choose>
				   </td></shiro:hasPermission>
				</tr>
				<!-- 订单明细  开始-->
					<div id="myOrder_${jiuCashRecord.id}" class="modal hide fade" tabindex="-1" style="width:900px;margin-left:-500px;" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
								<h3 id="myModalLabel">明细</h3>
							</div>
											
							<div class="modal-body">
							  <h6>订单详情</h6>
							   <section class="gray-div">
										<div style="background: #FFFFFF; text-align: left; color: #666666;">
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">订单号：${jiuCashRecord.orderNo}</p>
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">会员名称：${jiuCashRecord.memberName}</p>
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">会员OpenId：${jiuCashRecord.memberOpenId}</p>
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">会员手机号：${jiuCashRecord.memberMobile}</p>
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">消费金额：${jiuCashRecord.money} 元</p>
										    <p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">支付状态：${jiuCashRecord.status == 0 ? "未支付" : jiuCashRecord.status == 1 ? "已支付" : "已退款"}</p>
										    <p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">订单创建时间：<fmt:formatDate value="${jiuCashRecord.createTime}" type="both" pattern="yyyy-MM-dd HH:mm:ss" /></p>
										</div>
									</section>
								<h6>支付详情</h6>
									<section class="gray-div">
										<div style="background: #FFFFFF; text-align: left; color: #666666;">
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">订单支付时间：<fmt:formatDate value="${jiuCashRecord.payTime}" type="both" pattern="yyyy-MM-dd HH:mm:ss" /></p>
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">订单支付状态：${jiuCashRecord.payStatus == null  ?  " --- "  : jiuCashRecord.payStatus == 0 ? "支付失败" : "支付成功" }</p>
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">订单支付失败信息：【${jiuCashRecord.errorCode }】- ${jiuCashRecord.errorMsg }</p>
										</div>
									</section>
									
									<h6>退款详情</h6>
									<section class="gray-div">
										<div style="background: #FFFFFF; text-align: left; color: #666666;">
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">订单退款时间：<fmt:formatDate value="${jiuCashRecord.refundTime}" type="both" pattern="yyyy-MM-dd HH:mm:ss" /></p>
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">订单退款状态：${jiuCashRecord.refundStatus == null  ? " --- " : jiuCashRecord.refundStatus == 0 ? "退款失败" : "退款成功" }</p>
											<p style="font-size: 14px; padding: 10px 10px 2.5px 10px;">订单退款失败信息：【${jiuCashRecord.refundErrorCode}】- ${jiuCashRecord.refundErrorMsg }</p>
										</div>
									</section>
									
							</div>
							<div class="modal-footer">
								<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
							</div>
					</div> 
					<!-- 订单明细  结束-->				
			</c:forEach>
		</tbody>
	</table>
	
	<div class="pagination">${page}</div>
</body>
</html>
